package com.rulesHello;

import com.pojo.PersonP;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

/**
 * @author Administrator
 */
public class RulesHello {

    public static void main(String[] args) {
        KieServices kss = KieServices.Factory.get();
        KieContainer kc = kss.getKieClasspathContainer();
        KieSession ks = kc.newKieSession("testhelloworld");

        PersonP person = new PersonP();
        person.setName("张三");
        person.setAge(30);
        ks.insert(person);
        int count = ks.fireAllRules();
        System.out.println("总执行了"+count+"条规则");
        System.out.println("输出修改后的Person age="+ person.getAge());
        ks.dispose();
    }
}
